<!-- 首页 -->
<template>
	<view class="container">
		<van-picker :default-index="current" :columns="columns" @change="handleChange">
		</van-picker>
	</view>
</template>

<script>
	export default {
		name: "",
		props: ['value'],
		data() {
			return {
				current: 0,
				columns: [
					"白羊座", "金牛座", "双子座", "巨蟹座",
					"狮子座", "处女座", "天秤座", "天蝎座",
					"射手座", "摩羯座", "水瓶座", "双鱼座"
				]
			}
		},
		watch: {
			value: {
				immediate: true,
				handler(value) {
					if (value) {
						this.current = this.columns.indexOf(value)
					}
				}
			}
		},
		methods: {
			handleChange(picker) {
				let {
					detail: {
						value
					}
				} = picker
				this.$emit('input', value)
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {}
</style>